s=(1,2,3,4,5,6,7,8,9,10)
while True:
    try:
        num=int(input("input a number:"))
    except  ValueError:
        print("please input a number")
    else:
        break

try:
    location=s.index(num)
    print('the location is:',location)
except ValueError:
    print("not in the tuple")
else:
    choice='0'
    while choice not in ('1','2','3'):
        choice=input("What do you want to do to this number?\n1.delete\n2.change\n3.do nothing\n")
    if choice=='1':
        s=s[:location]+s[location+1:]
        print(s)
    elif choice=='2':
        s=s[:location]+(int(input("input a number:")),)+s[location+1:]
        print(s)
    else:
        print(s)

#进制转换
def change(num:int,base=2):
    stack=[]
    if base<2 or base>36:
        print("please input a number between 2 and 36")
        return 0
    else:
        if num<0:
            print("please input a positive number")
        else:
            if base<11:
                while num>0:
                    stack.append(num%base)
                    num=num//base
                stack.reverse()
                st=''.join(map(str,stack))
                return st
            else:
                while num>0:
                    stack.append(num%base)
                    num=num//base
                stack.reverse()
                for i in range(len(stack)):
                    if stack[i]>=10:
                        stack[i]=chr(stack[i]+55)
                st=''.join(map(str,stack))
                return st

print(change(1667,32))

#简单的用户登录
cishu=3 #全局
def login(user,password):
    global cishu
    password=str(password)
    account={'admin':'123456','user1':'1234567','user2':'1234568'}
    #尝试3次
    while cishu>0:
        if user in account.keys():
            if password==account[user]:
                print("login success")
                break
            else:
                print("password error")
                cishu-=1
                return 0
        else:
            print("user not exist")
            cishu-=1
            return 0
    if cishu==0:
        print("login failed, out of chance")

'''
u=input("input your username:")
p=input("input your password:")
login(u,p)'''
login('admin',12456)
login('admin',124456)
login('admin',123456)

